Skip to content

feat(otel): add complete OTEL configuration fields#143

Merged
AnnatarHe merged 1 commit intomainfrom
claude/issue-142-20251216-0558
Dec 16, 2025
Merged

feat(otel): add complete OTEL configuration fields#143
AnnatarHe merged 1 commit intomainfrom
claude/issue-142-20251216-0558

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

Added missing OpenTelemetry configuration fields for all supported shells (bash, zsh, fish):

  • OTEL_METRIC_EXPORT_INTERVAL (10000ms)
  • OTEL_LOGS_EXPORT_INTERVAL (5000ms)
  • OTEL_LOG_USER_PROMPTS (enabled)
  • OTEL_METRICS_INCLUDE_SESSION_ID (enabled)
  • OTEL_METRICS_INCLUDE_VERSION (enabled)
  • OTEL_METRICS_INCLUDE_ACCOUNT_UUID (enabled)
  • OTEL_RESOURCE_ATTRIBUTES (with dynamic user.name, machine.name, team.id)

This provides comprehensive telemetry configuration as requested in issue #142.

Fixes #142

Generated with Claude Code

…stall

Added missing OpenTelemetry configuration fields for all supported shells (bash, zsh, fish):
- OTEL_METRIC_EXPORT_INTERVAL (10000ms)
- OTEL_LOGS_EXPORT_INTERVAL (5000ms)
- OTEL_LOG_USER_PROMPTS (enabled)
- OTEL_METRICS_INCLUDE_SESSION_ID (enabled)
- OTEL_METRICS_INCLUDE_VERSION (enabled)
- OTEL_METRICS_INCLUDE_ACCOUNT_UUID (enabled)
- OTEL_RESOURCE_ATTRIBUTES (with dynamic user.name, machine.name, team.id)

This provides comprehensive telemetry configuration as requested in issue #142.

Fixes #142

Co-authored-by: Le He <AnnatarHe@users.noreply.github.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the OpenTelemetry integration by adding a comprehensive set of configuration fields across bash, zsh, and fish shells. The changes aim to provide more detailed and configurable telemetry collection, including specific intervals for metric and log exports, user prompt logging, and richer resource attributes, addressing the requirements outlined in issue #142.

Highlights

  • OpenTelemetry Metric Export Interval: The OTEL_METRIC_EXPORT_INTERVAL environment variable is now set to 10000ms (10 seconds) for all supported shells (bash, zsh, fish).
  • OpenTelemetry Log Export Interval: The OTEL_LOGS_EXPORT_INTERVAL environment variable is now set to 5000ms (5 seconds) for all supported shells.
  • User Prompt Logging: The OTEL_LOG_USER_PROMPTS environment variable is enabled (1) to allow logging of user prompts.
  • Session ID Inclusion in Metrics: The OTEL_METRICS_INCLUDE_SESSION_ID environment variable is set to true to include session IDs in exported metrics.
  • Version Inclusion in Metrics: The OTEL_METRICS_INCLUDE_VERSION environment variable is set to true to include version information in exported metrics.
  • Account UUID Inclusion in Metrics: The OTEL_METRICS_INCLUDE_ACCOUNT_UUID environment variable is set to true to include account UUIDs in exported metrics.
  • Dynamic Resource Attributes: The OTEL_RESOURCE_ATTRIBUTES environment variable is configured to dynamically capture user.name (using whoami), machine.name (using hostname), and a static team.id (shelltime).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
model/ccotel_env.go 0.00% 21 Missing ⚠️
Flag Coverage Δ
unittests 20.87% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
model/ccotel_env.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds several new OpenTelemetry configuration fields for bash, zsh, and fish shells, which is great for providing more comprehensive telemetry. The implementation involves adding hardcoded strings for each shell type. While this works, it introduces code duplication and magic values. I've suggested using constants to improve maintainability. Additionally, for the fish shell, I've recommended using the idiomatic command substitution syntax to improve compatibility and adhere to best practices.

Comment thread model/ccotel_env.go
Comment on lines +118 to +124
"export OTEL_METRIC_EXPORT_INTERVAL=10000",
"export OTEL_LOGS_EXPORT_INTERVAL=5000",
"export OTEL_LOG_USER_PROMPTS=1",
"export OTEL_METRICS_INCLUDE_SESSION_ID=true",
"export OTEL_METRICS_INCLUDE_VERSION=true",
"export OTEL_METRICS_INCLUDE_ACCOUNT_UUID=true",
"export OTEL_RESOURCE_ATTRIBUTES=\"user.name=$(whoami),machine.name=$(hostname),team.id=shelltime\"",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These new OTEL configuration values are hardcoded and duplicated across the NewBashCCOtelEnvService, NewZshCCOtelEnvService, and NewFishCCOtelEnvService functions. This code duplication, especially between the bash and zsh implementations which are identical, can make future updates error-prone and tedious.

To improve maintainability, I recommend defining these values as constants at the package level. This centralizes the configuration, reduces the risk of inconsistencies, and makes the code easier to read and manage.

For example, you could define constants for the new settings:

const (
    // ... existing constants
    otelMetricExportInterval = "10000"
    otelLogsExportInterval   = "5000"
    otelLogUserPrompts       = "1"
    otelMetricsIncludeSessID = "true"
    // ... and so on
)

Then, these constants can be used to construct the envLines slices for each shell. While a larger refactoring to eliminate the duplicated envLines slices might be out of scope for this PR, introducing constants for these new values would be a valuable improvement.

Comment thread model/ccotel_env.go
"set -gx OTEL_METRICS_INCLUDE_SESSION_ID true",
"set -gx OTEL_METRICS_INCLUDE_VERSION true",
"set -gx OTEL_METRICS_INCLUDE_ACCOUNT_UUID true",
"set -gx OTEL_RESOURCE_ATTRIBUTES \"user.name=$(whoami),machine.name=$(hostname),team.id=shelltime\"",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For fish shell, the idiomatic syntax for command substitution is (command) rather than $(command). While $(command) is supported in modern versions of fish for POSIX compatibility, using the native (command) syntax is preferred. It ensures better compatibility with all fish versions and aligns with the shell's design principles.

Suggested change
"set -gx OTEL_RESOURCE_ATTRIBUTES \"user.name=$(whoami),machine.name=$(hostname),team.id=shelltime\"",
"set -gx OTEL_RESOURCE_ATTRIBUTES \"user.name=(whoami),machine.name=(hostname),team.id=shelltime\""

@AnnatarHe AnnatarHe merged commit 9eaf222 into main Dec 16, 2025
5 of 6 checks passed
@AnnatarHe AnnatarHe deleted the claude/issue-142-20251216-0558 branch December 16, 2025 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

in cc install and uninstall command. add more config

1 participant